<?php

namespace Wgx\Admin\Com\Crud\ListPageSearchInput;

use Wgx\Admin\Com\Crud\ListPageSearchInputBase;

abstract class InputInputBase extends ListPageSearchInputBase
{
    /** @var string */
    private $label;
    /** @var null|string */
    private $placeholder;
    /** @var mixed */
    private $initialValue;
    /** @var null|string */
    private $className;
    /** @var null|string */
    private $specParam;

    /**
     * InputInputBase constructor.
     * @param string $label
     * @param null|string $placeholder
     * @param mixed $initialValue
     * @param null|string $className - 额外指定的 class
     * @param null|string $specParam - 额外指定的参数
     */
    public function __construct($label, $placeholder = null, $initialValue = null, $className = null, $specParam = null)
    {
        $this->label = $label;
        $this->placeholder = $placeholder;
        $this->initialValue = $initialValue;
        $this->className = $className;
        $this->specParam = $specParam;
    }

    /**
     * @inheritDoc
     */
    public function getLabel()
    {
        return $this->label;
    }

    /**
     * @param string $label
     * @return InputInputBase
     */
    public function setLabel($label)
    {
        $this->label = $label;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getPlaceholder()
    {
        return $this->placeholder;
    }

    /**
     * @param string|null $placeholder
     */
    public function setPlaceholder($placeholder)
    {
        $this->placeholder = $placeholder;
    }

    /**
     * 指定 <input> 标签的 type attribute 的值
     * @return string
     */
    abstract public function getType();

    /**
     * @inheritDoc
     */
    public function getInitialValue()
    {
        return $this->initialValue;
    }

    /**
     * 指定用户输入控件的初始值
     * @param mixed $initialValue - 数据类型同 $optionMap 的键的类型
     */
    public function setInitialValue($initialValue)
    {
        $this->initialValue = $initialValue;
    }

    /**
     * 额外指定的 class
     * @return string|null
     */
    public function getClassName()
    {
        return $this->className;
    }

    /**
     * @param string|null $className - 额外指定的 class
     * @return InputInputBase
     */
    public function setClassName($className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 额外指定的参数
     * @return string|null
     */
    public function getSpecParam()
    {
        return $this->specParam;
    }

    /**
     * @param string|null $specParam - 额外指定的参数
     * @return InputInputBase
     */
    public function setSpecParam($specParam)
    {
        $this->specParam = $specParam;
        return $this;
    }

}